import {UserActions} from './user';

const initialState = {};

export const AssociateAccountActions = {
  PROFILE_ASSOCIATE_ACCOUNT_UPDATE: 'profile_associate_account_update',
  PROFILE_ASSOCIATE_ACCOUNT_RESET: 'profile_associate_account_reset',
};

export function updateAssociateAccount(payload) {
  return {
    type: AssociateAccountActions.PROFILE_ASSOCIATE_ACCOUNT_UPDATE,
    payload,
  };
}

export function resetAssociateAccount() {
  return {
    type: AssociateAccountActions.PROFILE_ASSOCIATE_ACCOUNT_RESET,
  };
}

export default function associateAccount(state = initialState, action) {
  switch (action.type) {
    case AssociateAccountActions.PROFILE_ASSOCIATE_ACCOUNT_UPDATE:
      return {...action.payload};
    case AssociateAccountActions.PROFILE_ASSOCIATE_ACCOUNT_RESET:
      return {};
    case UserActions.USER_SIGN_OUT:
      return {};
    default:
      return state;
  }
}
